package com.drakeet.multitype.sample.comment.adapter

import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import com.drakeet.multitype.ItemViewBinder
import com.drakeet.multitype.sample.R
import com.drakeet.multitype.sample.comment.input.DialogHelper
import com.drakeet.multitype.sample.comment.input.InputTextMsgDialog
import com.drakeet.multitype.sample.comment.model.Comment

/**
 * Describe:
 * Author: lifei
 * Date: 2020/11/6
 * Email: lifei022454@gtjas.com
 */
class CommentAdapter : ItemViewBinder<Comment, CommentAdapter.ViewHolder>() {

    override fun onCreateViewHolder(inflater: LayoutInflater, parent: ViewGroup): ViewHolder {
        return ViewHolder(inflater.inflate(R.layout.item_comment_parent, parent, false))
    }

    override fun onBindViewHolder(holder: ViewHolder, item: Comment) {
        Log.i("lifei", "hha test 000")
        holder.content.setOnClickListener {
            Log.i("lifei", "hhah test  " + holder.itemView)
            DialogHelper().initInputTextMsgDialog(holder.itemView?.context)
        }
    }

    open class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        val content: TextView = itemView.findViewById(R.id.tv_content)
    }
}